Skip to content

chore: Fix some issues with static analysis#88

Draft
jason-famedly wants to merge 22 commits intomainfrom
jason/tech-debt-1
Draft

chore: Fix some issues with static analysis#88
jason-famedly wants to merge 22 commits intomainfrom
jason/tech-debt-1

Conversation

@jason-famedly
Copy link
Copy Markdown
Member

In an effort to use hatch fmt static analysis tooling(such as mypy), need to fix up a few things.

This part is a general and broad house cleaning that should reduce some boilerplate issues

"The easy parts"

…able" by typing dict as JsonDict, which allows for values of Any
…e ones that handle dictionaries that translate to JSON
…nd make them a Protocol instead of a Union

the goal of this is to remove things from generic 'utils' style junk
drawers and have them be clearly labeled
…en' attribute(I do not believe it is used by the token authenticator)
…ns to unify the response types and use future annotations

Also, was using the module_api module to import the LoginResponse and
JsonDict. They are present in that module but do not show up correctly
for static analysis. Import them directly
…ttributes always exist now(even if they are None)
…med inside each checker function

"config -> jwt_cfg", for example. Assertions are present to help mypy
figure out that these values can not be None here
…ther is a JSON string(was a dict, which was coercable)
…word_auth_provider_callbacks() to guarantee it does not drift
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 73.55932% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.81%. Comparing base (84a327e) to head (891cf93).

Files with missing lines Patch % Lines
synapse_token_authenticator/config.py 78.47% 18 Missing and 13 partials ⚠️
synapse_token_authenticator/auth_headers.py 51.06% 23 Missing ⚠️
synapse_token_authenticator/token_authenticator.py 79.36% 5 Missing and 8 partials ⚠️
synapse_token_authenticator/rest.py 65.62% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #88      +/-   ##
==========================================
+ Coverage   73.28%   73.81%   +0.53%     
==========================================
  Files           5        7       +2     
  Lines         756      779      +23     
  Branches      145      146       +1     
==========================================
+ Hits          554      575      +21     
- Misses        143      145       +2     
  Partials       59       59              
Files with missing lines Coverage Δ
synapse_token_authenticator/claims_validator.py 77.60% <100.00%> (ø)
synapse_token_authenticator/utils.py 100.00% <100.00%> (+9.09%) ⬆️
synapse_token_authenticator/rest.py 65.62% <65.62%> (ø)
synapse_token_authenticator/token_authenticator.py 72.22% <79.36%> (+0.75%) ⬆️
synapse_token_authenticator/auth_headers.py 51.06% <51.06%> (ø)
synapse_token_authenticator/config.py 76.28% <78.47%> (+7.46%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84a327e...891cf93. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant